home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
AIncludes
/
TextParser.a
< prev
next >
Wrap
Text File
|
1996-05-01
|
14KB
|
419 lines
;
; File: TextParser.a
;
; Contains: International Text Parser Interfaces.
;
; Version: Technology: System 8
; Release: Universal Interfaces 3.0d3 on Copland DR1
;
; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
;
; Bugs?: If you find a problem with this file, send the file and version
; information (from above) and the problem description to:
;
; Internet: apple.bugs@applelink.apple.com
; AppleLink: APPLE.BUGS
;
;
IF &TYPE('__TEXTPARSER__') = 'UNDEFINED' THEN
__TEXTPARSER__ SET 1
IF &TYPE('__CONDITIONALMACROS__') = 'UNDEFINED' THEN
include 'ConditionalMacros.a'
ENDIF
IF FOR_SYSTEM8_PREEMPTIVE THEN
IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
include 'Types.a'
ENDIF
IF &TYPE('__TEXTOBJECTS__') = 'UNDEFINED' THEN
include 'TextObjects.a'
ENDIF
IF &TYPE('__TEXTCOMMON__') = 'UNDEFINED' THEN
include 'TextCommon.a'
ENDIF
IF &TYPE('__LOCALEOBJECTS__') = 'UNDEFINED' THEN
include 'LocaleObjects.a'
ENDIF
ENDIF
IF FOR_SYSTEM8_PREEMPTIVE THEN
; typedef UInt32 ParsingToken
; typedef ParsingToken BasicToken
; typedef ParsingToken RangeToken
; typedef ParsingToken KeywordToken
; typedef ParsingToken MultiChoiceToken
; typedef ParsingToken ComposedToken
; defintions for the future
; typedef ParsingToken RegExpToken
; typedef ParsingToken GrammarRuleToken
; definition of Pointers to tokens
; typedef ParsingToken * ParsingTokenPtr
; typedef ParsingTokenPtr BasicTokenPtr
; typedef ParsingTokenPtr RangeTokenPtr
; typedef ParsingTokenPtr KeywordTokenPtr
; typedef ParsingTokenPtr MultiChoiceTokenPtr
; typedef ParsingTokenPtr ComposedTokenPtr
; typedef OptionBits ParsingOptionBits
; typedef LocaleObjectRef ParserLocaleObjectRef
;ParsingOptionBits
kParseMainTokenOptionBit EQU 0
kIsAlphaNumericKeyWordOptionBit EQU 1
kIsCaseSensitiveParsingOptionBit EQU 2
kIsDiacreticSensitiveParsingOptionBit EQU 3
kParseTextEnclosedByLitearlDelimitersOptionBit EQU 4
kIsCommentsAllowedOptionBit EQU 5
;ParsingOptionMask
kStandardParsingOptionsMask EQU 0
kParseMainTokenOptionMask EQU $00000001
kIsAlphaNumericKeyWordOptionMask EQU $00000002
kIsCaseSensitiveParsingOptionMask EQU $00000004
kIsDiacreticSensitiveParsingOptionMask EQU $00000008
kParseTextEnclosedByLitearlDelimitersOptionMask EQU $00000010
kIsCommentsAllowedOptionMask EQU $00000020
; Basic Tokens definitions (try to match system 7 tokens when possible
kBasicTokenUnknown EQU 0 ;characters that don't have token definition
kBasicTokenEscape EQU 10 ;character escape (e.g. '\' in "\n", "\t")
kBasicTokenLeftParen EQU 16 ;open parenthesis
kBasicTokenRightParen EQU 17 ;close parenthesis
kBasicTokenLeftBracket EQU 18 ;open square bracket
kBasicTokenRightBracket EQU 19 ;close square bracket
kBasicTokenLeftCurly EQU 20
kBasicTokenRightCurly EQU 21 ;close curly bracket
kBasicTokentokenLeftEnclose EQU 22 ;open guillemet
kBasicTokenRightEnclose EQU 23 ;close guillemet
kBasicTokenPlus EQU 24
kBasicTokenMinus EQU 25
kBasicTokenAsterisk EQU 26 ;times/multiply
kBasicTokenDivide EQU 27
kBasicTokenPlusMinus EQU 28 ;plus or minus symbol
kBasicTokenSlash EQU 29
kBasicTokenBackSlash EQU 30
kBasicTokenLess EQU 31 ;less than symbol
kBasicTokenGreat EQU 32 ;greater than symbol
kBasicTokenEqual EQU 33
kBasicTokenLessEqual1 EQU 35 ;less than or equal, 1 character
kBasicTokenGreatEqual1 EQU 37 ;greater than or equal, 1 character
kBasicTokenNotEqual EQU 40 ;not equal, 1 character
kBasicTokenExclam EQU 43 ;exclamation point
kBasicTokenTilde EQU 44 ;centered tilde
kBasicTokenComma EQU 45
kBasicTokenPeriod EQU 46
kBasicTokenLeft2Quote EQU 47 ;open double quote
kBasicTokenRight2Quote EQU 48 ;close double quote
kBasicTokenLeft1Quote EQU 49 ;open single quote
kBasicTokenRight1Quote EQU 50 ;close single quote
kBasicToken2Quote EQU 51 ;double quote
kBasicToken1Quote EQU 52 ;single quote
kBasicTokenSemicolon EQU 53
kBasicTokenPercent EQU 54
kBasicTokenCaret EQU 55
kBasicTokenUnderline EQU 56
kBasicTokenAmpersand EQU 57
kBasicTokenAtSign EQU 58
kBasicTokenBar EQU 59 ;vertical bar
kBasicTokenQuestion EQU 60
kBasicTokenPi EQU 61 ;lower-case pi
kBasicTokenRoot EQU 62 ;square root symbol
kBasicTokenSigma EQU 63 ;capital sigma
kBasicTokenIntegral EQU 64 ;integral sign
kBasicTokenMicro EQU 65
kBasicTokenCapPi EQU 66 ;capital pi
kBasicTokenInfinity EQU 67
kBasicTokenColon EQU 68
kBasicTokenHash EQU 69 ;e.g. #
kBasicTokenDollar EQU 70
kBasicTokenNoBreakSpace EQU 71 ;non-breaking space
kBasicTokenFraction EQU 72
kBasicTokenIntlCurrency EQU 73
kBasicTokenLeftSingGuillemet EQU 74
kBasicTokenRightSingGuillemet EQU 75
kBasicTokenPerThousand EQU 76
kBasicTokenEllipsis EQU 77
kBasicTokenCenterDot EQU 78
kBasicTokenSpace EQU 128
kBasicTokenPasswordChar EQU 129
;predefined composed tokens
kComposedTokenLessEqual2 EQU 16383 ;less than or equal, 2 characters (e.g. <=)
kComposedTokenEqual2 EQU 16384 ;greater than or equal, 2 characters (e.g. >=)
kComposedToken2Equal EQU 16385 ;double equal (e.g. ==)
kComposedTokenColonEqual EQU 16386 ;colon equal
kComposedTokenLessGreat EQU 16387 ;less/greater, Pascal not equal (e.g. <>)
kComposedTokenExclamEqual EQU 16388 ;exclamation equal, C not equal (e.g. !=)
kComposedTokenNewLine EQU 16389 ;composed may be more than one (10,13)
;predefined multiple choice tokens
kChoiceTokenWhite EQU 8192 ;white space (CR,LF,space, non break space)
kChoiceTokenLeftLit EQU 8193 ;literal begin , can be one or more
kChoiceTokenRightLit EQU 8194 ;literal end, can be one or more
kChoiceTokenAlpha EQU 8195 ;alphabetic char
kChoiceTokenNumeric EQU 8196 ;numeric char
kChoiceTokenPunctuationChar EQU 8197 ;punctuation char
kChoiceTokenRightComment EQU 8198 ; can be one or more
kChoiceTokenLeftComment EQU 8199 ; can be one or more
;predefined token classes (not overridable for 8.0) mapped to regular expression tokens
kTokenClassIdentifier EQU 32768 ; alphabetic or alphanumeric entities
kTokenClassComment EQU 32769 ; anything inside comment delimiters
kTokenClassliteral EQU 32770 ; anything inside literal delimiters
kTokenClassIntegerNumber EQU 32771 ; text is numeric presentation (integers)
kTokenClassFloatingNumber EQU 32772 ;text is numeric presentation (float)
CharacterRange RECORD 0
; structure defining a range of char
theCharRangeBegin ds.l 1 ; offset: $0 (0)
theCharRangeEnd ds.l 1 ; offset: $4 (4)
sizeof EQU * ; size: $8 (8)
ENDR
; typedef struct CharacterRange * CharacterRangePtr
; ============================================================locale object parser APIs====================================================
;
; extern OSStatus GetParserObjectByLocaleID(LocaleIdentifier theLocaleIdentifier, TextEncoding theEncoding, ParserLocaleObjectRef *theParserObject)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetParserObjectByLocaleID
ENDIF
;
; extern OSStatus GetParserObjectByLocaleRef(LocaleRef locale, TextEncoding theEncoding, ParserLocaleObjectRef *theParserObject)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetParserObjectByLocaleRef
ENDIF
;
; extern OSStatus GetCurrentParserObject(ParserLocaleObjectRef *theParserObject)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetCurrentParserObject
ENDIF
;
; extern OSStatus GetParserObjectInfo(ParserLocaleObjectRef theParserObject, TextEncoding *theEncoding, LocaleIdentifier *theLocaleIdentifier)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetParserObjectInfo
ENDIF
; ======================================================Iterator creation/modifcation==========================================================
;
; extern OSStatus CreateLexicalIterator(ParserLocaleObjectRef localeParserRef, TextObject theTextObject, TextObjectIndex startIndex, TextObjectIndex endIndex, ParsingOptionBits theParsingOptions, TTextParseRef *theParserRef)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION CreateLexicalIterator
ENDIF
;
; extern OSStatus LexicalIteratorGetNextToken(TTextParseRef theParser, ParsingToken *theCurrentToken, TextObjectIndex *startIndex, TextObjectIndex *endIndex)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION LexicalIteratorGetNextToken
ENDIF
;
; extern OSStatus LexicalIteratorSetCommentDelimiters(TTextParseRef refLexicalIterator, ParsingToken tokenLeftDel, ParsingToken tokenRightDel)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION LexicalIteratorSetCommentDelimiters
ENDIF
;
; extern OSStatus LexicalIteratorReset(TTextParseRef refLexicalIterator)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION LexicalIteratorReset
ENDIF
;
; extern OSStatus LexicalIteratorSetText(TTextParseRef refLexicalIterator, TextObject theTextObject, TextObjectIndex startIndex, TextObjectIndex endIndex)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION LexicalIteratorSetText
ENDIF
;
; extern OSStatus LexicalIteratorSetTokenToMatch(TTextParseRef refLexicalIterator, ComposedToken theToken)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION LexicalIteratorSetTokenToMatch
ENDIF
; ======================================================Tokens Get/Set APIs ==========================================================
;
; extern OSStatus LexicalIteratorDefineBasicToken(TTextParseRef refLexicalIterator, UInt32 theChar, BasicToken theToken)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION LexicalIteratorDefineBasicToken
ENDIF
;
; extern OSStatus GetUniqueBasicToken(TTextParseRef refLexicalIterator, BasicToken *theToken)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetUniqueBasicToken
ENDIF
;
; extern OSStatus LexicalIteratorDefineKeywordToken(TTextParseRef refLexicalIterator, TextObject theText, TextObjectIndex theStart, TextObjectIndex theEnd, KeywordToken theToken)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION LexicalIteratorDefineKeywordToken
ENDIF
;
; extern OSStatus GetUniqueKeywordToken(TTextParseRef refLexicalIterator, KeywordToken *theToken)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetUniqueKeywordToken
ENDIF
;
; extern OSStatus LexicalIteratorDefineRangeToken(TTextParseRef refLexicalIterator, UInt32 rangeBeginChar, UInt32 rangeEndChar, RangeToken theToken)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION LexicalIteratorDefineRangeToken
ENDIF
;
; extern OSStatus GetUniqueRangeToken(TTextParseRef refLexicalIterator, RangeToken *theToken)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetUniqueRangeToken
ENDIF
;
; extern OSStatus LexicalIteratorDefineMultiChoiceToken(TTextParseRef refLexicalIterator, ItemCount nChoices, ParsingToken theChoices[2147483647], MultiChoiceToken *theToken)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION LexicalIteratorDefineMultiChoiceToken
ENDIF
;
; extern OSStatus GetUniqueMultiChoiceToken(TTextParseRef refLexicalIterator, MultiChoiceToken *theToken)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetUniqueMultiChoiceToken
ENDIF
;
; extern OSStatus LexicalIteratorDefineComposedToken(TTextParseRef refLexicalIterator, ItemCount nChoices, ParsingToken theChoices[2147483647], ComposedToken *theToken)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION LexicalIteratorDefineComposedToken
ENDIF
;
; extern OSStatus GetUniqueComposedToken(TTextParseRef refLexicalIterator, ComposedToken *theToken)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetUniqueComposedToken
ENDIF
;
; extern OSStatus GetTextFromToken(TTextParseRef refLexicalIterator, ParsingToken theToken, TextObject TheText)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetTextFromToken
ENDIF
;
; extern OSStatus GetLocaleTextFromToken(ParserLocaleObjectRef localeParserRef, ParsingToken theToken, TextObject TheText)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetLocaleTextFromToken
ENDIF
;
; extern OSStatus GetRangeToken(TTextParseRef refLexicalIterator, RangeToken theToken, UInt32 *beginRangeChar, UInt32 *endRangeChar)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetRangeToken
ENDIF
;
; extern OSStatus GetLocaleRangeToken(ParserLocaleObjectRef localeParserRef, RangeToken theToken, UInt32 *beginRangeChar, UInt32 *endRangeChar)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetLocaleRangeToken
ENDIF
;
; extern OSStatus GetCountTokenChoices(TTextParseRef refLexicalIterator, MultiChoiceToken theToken, ItemCount *nChoices)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetCountTokenChoices
ENDIF
;
; extern OSStatus GetLocaleCountTokenChoices(ParserLocaleObjectRef localeParserRef, MultiChoiceToken theToken, ItemCount *nChoices)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetLocaleCountTokenChoices
ENDIF
;
; extern OSStatus GetMultiChoiceToken(TTextParseRef refLexicalIterator, MultiChoiceToken theToken, ParsingToken theChoices[2147483647])
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetMultiChoiceToken
ENDIF
;
; extern OSStatus GetLocaleMultiChoiceToken(ParserLocaleObjectRef localeParserRef, MultiChoiceToken theToken, ParsingToken theChoices[2147483647])
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetLocaleMultiChoiceToken
ENDIF
;
; extern OSStatus GetCountTokenComposition(TTextParseRef refLexicalIterator, ComposedToken theToken, ItemCount *nChoices)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetCountTokenComposition
ENDIF
;
; extern OSStatus GetLocaleCountTokenComposition(ParserLocaleObjectRef localeParserRef, ComposedToken theToken, ItemCount *nChoices)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetLocaleCountTokenComposition
ENDIF
;
; extern OSStatus GetComposedToken(TTextParseRef refLexicalIterator, ComposedToken theToken, ParsingToken theComposition[2147483647])
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetComposedToken
ENDIF
;
; extern OSStatus GetLocaleComposedToken(ParserLocaleObjectRef localeParserRef, ComposedToken theToken, ParsingToken theChoices[2147483647])
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetLocaleComposedToken
ENDIF
ENDIF
ENDIF ; __TEXTPARSER__